import http from '@/utils/request.js';

const getParams = (data) => {
	let str = '';
	for (const key in data || {}) {
		if (str.length) {
			str = str + '&' + key + '=' + data[key];
		} else {
			str = str + '?' + key + '=' + data[key];
		}
	}
	return str;
};

// 电梯详情
export const detail = (data) => {
	return http.post('/repair/to/estate/invoke', {
		url: '/estate/elevator/detail' + getParams(data),
		method: 'get',
		body: data
	}, 1);
};

// 获取当前停梯原因（任务
export const getStopResult = (data) => {
	return http.post('/repair/to/estate/invoke', {
		url: '/estate/home/public/elevatorPlanStatus' + getParams(data),
		method: 'get',
		body: data
	}, 1);
};

// 扫码获取电梯详情

export const feathEleStatus = (data) => {
	return http.post('/repair/to/estate/invoke', {
		url: '/estate/elevator/getElevatorDetail' + getParams(data),
		method: 'get',
		body: data
	}, 1,false);
};

// 获取运行详情
// feathMonitor
export const feathMonitor = (id) => {
	return http.post('/repair/to/estate/invoke', {
		url: '/estate/home/v2/devices/runDetails/' + id,
		method: 'get',
		body: {}
	}, 1);
};

// 开启实时数据推送
export const openPush = (data) => {
	return http.post('/repair/to/estate/invoke', {
		url: '/tlw/video/v1/devices/open/status',
		method: 'post',
		body: data
	}, 1);
};
